package com.java.servlet.web.commons;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import org.apache.log4j.Logger;

public class GenericDao {
	private static final Logger log = Logger.getLogger(GenericDao.class);
    public void closeResultSet(ResultSet rs) {
        try {
            if (rs != null && !rs.isClosed()) {
                rs.close();
            }
        } catch (SQLException ex) {
            log.error("Error al intentar liberar recursos. Error cerrar el ResultSet.", ex);
        }
    }

    public void closeStatement(Statement statment) {
        try {
            if (statment != null && !statment.isClosed()) {
                statment.close();
            }
        } catch (SQLException ex) {
            log.error("Error al intentar liberar recursos. Error cerrar la sentencia. " + statment, ex);
        }
    }
}
